<!DOCTYPE html>
<html lang="en" style="width:100%">

<head>
    <meta charset="UTF-8">
    <!--    <name>图层配置</name>-->
    <title>图层管理</title>
    <link href="../../lib/bootstrap/bootstrap.css" rel="stylesheet">
    <link href="../../lib/bootstrap/bootstrap-table/bootstrap-table.css" rel="stylesheet">
    <script src="../../lib/jquery/jquery-3.5.1.min.js"></script>
    <link href="../../component/layui/css/layui.css" rel="stylesheet" />
    <link href="../../admin/css/pearCommon.css" rel="stylesheet" />
    <link href="./layerConfig.css" rel="stylesheet" />
    <script src="../../view/iconfont/iconfont.js"></script>
    <link href="../../view/iconfont/iconfont.css" rel="stylesheet">
    <script src="../../lib/bootstrap/bootstrap.min.js"></script>
    <script src="../../lib/bootstrap/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="../../lib/bootstrap/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
</head>

<body style="width:100%;height: 100%">
    <div id="head">
        <!--    <div style="color: white;font-size: 26px;margin-left: 35px;height:50px; line-height:50px; "> 图层</div>-->
        <!--    <div id="layerFonts" > <span class="layerFonts">图层管理</span></div>-->
        <div class="back">
            <div class="layerBack" id="layerBack">
                <span class="iconfont iconsign_out" style="color: #FFFFFF;width:20px;height:22px;font-size: 20px;"></span>
            </div>
        </div>
        <div class="layerTitle" style="cursor: pointer;">
            <div class="layerFonts">图层管理</div>
        </div>
    </div>
    <div id="content">
        <div id="leftBar">
            <div id="left-layer">
                <!--            <a class="logo_layer" id="logo_layer"><img src="img/layer.png " style="position: relative; width:30px;margin:13px;"></a>-->
                <a class="logo_layer" id="logo_layer"><img class="layer_off" src="img/layer_off.png" style="position: relative; width:30px;margin:13px;display:block"></a>
                <a class="logo_layer_on" id="logo_layer_on"><img class="layer_on" src="img/layer_on.png " style="position: relative; width:30px;margin:13px;display:none"></a>
            </div>
        </div>

        <div id="layerContent" style=" display: flex;">
            <iframe class="" id="layer_iframe" name="container" src="../../previewLayer.html" style="position: relative;width:100%;height:100%;border: none;margin-left: 56px;"></iframe>
            <div id="layer">
                <div id="layer_item1" style="cursor: pointer;">
                    <span style="position: absolute;width:56px; height:20px;font-family: PingFangSC-Regular;font-size: 14px;color: #333333;margin-left:16px;top:18px">图层配置</span>
                    <!--                <span style="position: relative; width:30px; margin-left:20px; font-size: 18px;">图层配置</span>-->
                    <a class="logo_close" id="logo_close">
                        <span class="iconfont icondelete" style="position:relative; width:20px;margin-left:228px;margin-right:16px;top:18px;"></span>
                        <!--                <img src="img/mini.png " style="position:relative; width:20px;margin-left:228px;margin-top:18px;background-color:gray">-->
                    </a>
                    <hr style="height:1px; width:224px;border:none;border-top:1px; background: #E0E0E0; margin-left:16px; margin-right:16px;margin-top:40px;" />
                </div>
                <div id="layer_item2">
                    <div class="layer_add" style="cursor: pointer;" id="layer_add">
                        <span class="iconfont iconadd" style=" position: relative; font-family: PingFangSC-Regular;font-size: 14px;color: #FFFFFF;">添加图层文件夹</span>
                    </div>
                    <!--                <div class="batchRemove" id="batchRemove">-->
                    <!--                    <span class="iconfont icontrash"></span>-->
                    <!--                </div>-->
                    <div class="demo-tree" id="treeLi">
                    </div>
                </div>
            </div>


            <div id="table">

                <span id="title" class="tabletitle">属性数据表</span> <span id="tableclose" class="iconfont icondelete closerightbtn">  </span>
                <div id="tablecontent" class="tablecontent">
                    <table id="table-business" lay-filter="table-business"></table>
                </div>
            </div>

        </div>
    </div>
    <div class="site-text" id="service-window" style="margin: 5%; display: none" target="test123">
        <form class="layui-form" id="service-add">
            <div class="layui-form-item" id="folder">
                <label class="layui-form-label">图层文件夹名称</label>
                <div class="layui-input-block">
                    <input autocomplete="off" class="layui-input" id="feature" lay-verify="required" name="title" placeholder="请输入图层文件夹名称" maxlength="50" required type="text">
                    <div class="layui-form-mid layui-word-aux">必填项</div>
                </div>
            </div>
            <div class="layui-form-item" id="layer-name">
                <label class="layui-form-label">图层名称</label>
                <div class="layui-input-block">
                    <input autocomplete="off" class="layui-input" id="feature-name" lay-verify="required" name="title" placeholder="请输入图层名称" maxlength="50" required type="text">
                    <div class="layui-form-mid layui-word-aux">必填项</div>
                </div>
            </div>
            <!--        <div class="layui-form-item" id="featureContent">-->
            <!--            <label class="layui-form-label"id="featureDetail" >图层描述</label>-->
            <!--            <div class="layui-input-block">-->
            <!--                <textarea class="layui-textarea" id="feature-detail" name="desc" placeholder="请输入图层描述" maxlength="200"></textarea>-->
            <!--            </div>-->
            <!--        </div>-->

            <div class="layui-form-item" id="research">
                <hr/>
                <div class="layui-input-block" style="display:inline-block;width:200px; float:left; margin-left: 15px">
                    <select id="selectFeature" lay-filter="selectFeature" lay-verify="" name="selectFeature">
                    <option value="">请选择添加一种要素类型</option>
                    <option value="1">自定义要素</option>
                    <option value="2">远程服务要素</option>
                        <option  value="3">业务要素</option>
                    <!--                    <option value="4">空间模型要素</option>-->
                </select>
                </div>
                <label class="layui-form-label">要素名称    </label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="demoReload" name="elementName" placeholder="" type="text">
                </div>
                <a class="pear-btn pear-btn-md pear-btn-primary" data-type="reload" id="featureSearch" lay-filter="user-query">
                    <i class="layui-icon layui-icon-search"></i> 查询
                </a>
                <!--            <button type="reset" class="pear-btn pear-btn-md">
                            <i class="layui-icon layui-icon-refresh"></i>
                            重置
                        </button>-->
            </div>
            <div class="layui-form-item">
                <div class="layui-card">
                    <div class="layui-card-body" id="user">
                        <table id="user-table" lay-filter="user-table"></table>
                    </div>
                </div>
            </div>
        </form>

    </div>
    <script id="data-type" type="text/html">
        {{#if (d.type == 1) { }}
        <span>自定义要素</span> {{# }else if(d.type == 2){ }}
        <span>远程服务要素</span> {{# }else if(d.type == 3){ }}
        <span>业务要素</span> {{# }else if(d.type == 4){ }}
        <span>空间模型要素</span> {{# } }}
    </script>
    <script src="../../component/layui/layui.js"></script>
    <script src="./layerConfig.js"></script>
    <script>
        var EntityId = [];
        var
            tree,
            openTree,
            getData,
            openTreePart,
            serviceType; //要素类型
        window.onload = function(obj) {
            var layerConfigObj = {};
            var featureId;
            var checkedType;
            var childWindow = $("#layer_iframe")[0].contentWindow; //调用iframe页面
            // 使用layui表单元素
            layui.use(['tree', 'util', 'table', 'form'], function() {
                let table = layui.table;
                let form = layui.form;
                tree = layui.tree,
                    layer = layui.layer,
                    util = layui.util;
                //启用图层
                layerConfigObj.start = function(data, checkedType) {
                    data.checked = checkedType;
                    var child = [];
                    if (data.children && data.children.length == 0) {
                        layer.msg("图层文件夹不存在图层，请添加后再启用", {
                            icon: 5
                        });
                    } else if ((data.children && data.isDir == "1") || (data.children && data.children.length > 0)) {
                        //    禁用和启用功能代码
                        function loop(item) {
                            $.ajax({
                                url: "/one/layer",
                                type: "PUT",
                                dataType: "json",
                                contentType: "application/json; charset=UTF-8",
                                data: JSON.stringify({
                                    elementId: item.elementId,
                                    id: item.id,
                                    isDir: item.isDir,
                                    parentId: item.parentId,
                                    layerName: item.title,
                                    remark: item.remark,
                                    sort: item.sort,
                                    status: 1
                                }),
                                success: function(result) {
                                    if (result.errorCode === '401') {
                                        loginStatusIntercept(result.msg)
                                        return
                                    }
                                    if (result.errorCode == 0) {
                                        // layer.msg("启用图层成功", {icon: 6});
                                    } else {
                                        layer.msg("启用图层失败，请检查图层对应的要素内容是否为空", {
                                            icon: 5
                                        });
                                    }
                                }
                            });
                        }
                        child = data.children;
                        child.forEach(item => loop(item));
                    } else {
                        $.ajax({
                            url: "/one/layer",
                            type: "PUT",
                            dataType: "json",
                            contentType: "application/json; charset=UTF-8",
                            data: JSON.stringify({
                                elementId: data.elementId,
                                id: data.id,
                                isDir: data.isDir,
                                parentId: data.parentId,
                                layerName: data.title,
                                remark: data.remark,
                                sort: data.sort,
                                status: data.checked ? 1 : 0
                            }),
                            success: function(result) {
                                if (result.errorCode === '401') {
                                        loginStatusIntercept(result.msg)
                                        return
                                    }
                                if (result.errorCode == 0) {
                                    // layer.msg("启用图层成功", {icon: 6});
                                    // console.log(result.status);
                                    // tree.reload('treeId', {data: getData()});
                                } else {
                                    layer.msg("启用图层失败，请检查图层对应的要素内容是否为空", {
                                        icon: 5
                                    });
                                }
                            }
                        });
                    }
                };
                //禁用图层
                layerConfigObj.close = function(data, checkedType) {
                    data.checked = checkedType;
                    var child = [];
                    if (data.children && data.children.length == 0) {
                        layer.msg("图层文件夹不存在图层，请添加后再禁用", {
                            icon: 5
                        });
                    } else if ((data.children && data.isDir == "1") || (data.children && data.children.length > 0)) {
                        // debugger
                        function loop(item) {
                            $.ajax({
                                url: "/one/layer",
                                type: "PUT",
                                dataType: "json",
                                contentType: "application/json; charset=UTF-8",
                                data: JSON.stringify({
                                    elementId: item.elementId,
                                    id: item.id,
                                    isDir: item.isDir,
                                    parentId: item.parentId,
                                    layerName: item.title,
                                    remark: item.remark,
                                    sort: item.sort,
                                    status: 0
                                }),
                                success: function(result) {
                                    if (result.errorCode === '401') {
                                        loginStatusIntercept(result.msg)
                                        return
                                    }
                                    if (result.errorCode == 0) {
                                        layer.msg("禁用图层成功", {
                                            icon: 6
                                        });
                                    } else {
                                        layer.msg("禁用图层失败", {
                                            icon: 5
                                        });
                                    }
                                }
                            });
                        }
                        child = data.children;
                        child.forEach(item => loop(item));

                    } else {
                        $.ajax({
                            url: "/one/layer",
                            type: "PUT",
                            dataType: "json",
                            contentType: "application/json; charset=UTF-8",
                            data: JSON.stringify({
                                elementId: data.elementId,
                                id: data.id,
                                isDir: data.isDir,
                                parentId: data.parentId,
                                layerName: data.title,
                                remark: data.remark,
                                sort: data.sort,
                                status: data.checked ? 1 : 0
                            }),
                            success: function(result) {
                                if (result.errorCode === '401') {
                                        loginStatusIntercept(result.msg)
                                        return
                                    }
                                if (result.errorCode == 0) {
                                    layer.msg("禁用图层成功", {
                                        icon: 6
                                    });
                                    // data.status = 0;
                                    // console.log(result);
                                } else {
                                    layer.msg("禁用图层失败，请检查图层对应的要素内容是否为空", {
                                        icon: 5
                                    });
                                }
                            }
                        });
                    }
                };
                //图层预览
                layerConfigObj.preview = function(obj) {
                    // var checkedType = obj.checked;
                    // console.log(obj.data);
                    var data = obj.data;
                    $.ajax({
                        url: "/one/layer/elementInfo",
                        type: "GET",
                        dataType: "json",
                        contentType: "application/json; charset=UTF-8",
                        data: {
                            id: data.id
                        },
                        success: function(result) {
                            if (result.errorCode === '401') {
                                loginStatusIntercept(result.msg)
                                return
                            }
                            if (result.errorCode == 0) {
                                var type = result.data.serviceType;
                                serviceType = type;
                                var themeType = result.data.themeType;
                                var previewUrl = result.data.elementContent;
                                //新页面预览
                                var jumpUrl = "";
                                childWindow = $("#layer_iframe")[0].contentWindow; //调用iframe页面
                                // 判断添加的服务地址是否为geoserver发布的服务;type:1-3dTiles,2-geoJson,4-wfs
                                if (type == 4) {
                                    jumpUrl = previewUrl; //jumpUrl通过geoserver截断解决跨域问题
                                    // jumpUrl = previewUrl.substr(previewUrl.indexOf("geoserver") - 1); //jumpUrl通过geoserver截断解决跨域问题
                                    childWindow.loadGeoJson(jumpUrl, data.id); //调用iframe页面中的函数
                                } else if (type == 2) {
                                    // var yunpa = JSON.parse(previewUrl).features.slice(1,2)
                                    // var objyun = {"features":yunpa}
                                    // console.log(JSON.stringify(objyun))
                                    // childWindow.loadJson(JSON.stringify(objyun), data.id, themeType);

                                    childWindow.loadJson(previewUrl, data.id, themeType);

                                } else if (type == 1) {
                                    //jumpUrl字符串中不含有geoserver字符串
                                    childWindow.load3Dtiles(previewUrl, data.id);
                                }
                            } else {
                                if (data.isDir == 1) {
                                    layer.msg("图层文件夹不支持预览", {
                                        icon: 5
                                    });
                                } else if (data.isDir == 0) {
                                    var nodeData = obj.data; //得到当前节点的数据
                                    setTimeout(function() {
                                        layer.msg("图层预览失败，请检查图层对应的要素内容是否禁用或不存在", {
                                            icon: 5
                                        });
                                    }, 1000);
                                    setTimeout(function() {
                                        layerConfigObj.del(nodeData);
                                        childWindow.removeEntityById(data.id);
                                        setTimeout(function() {
                                            var treeData = openTreePart(getData(), data); //解决节点操作后重新绘制树只显示根节点的问题——其实就是对后台返回数据做了处理
                                            tree.reload('treeId', {
                                                data: treeData
                                            });
                                        }, 1000);
                                    }, 2000);
                                }
                            }
                        }
                    });
                };
                // 点击时树展开，父节点spread字段赋值true
                openTreePart = function(treeData, nodeData) {
                    function each(data) {
                        try {
                            data.forEach(e => {
                                if (e.id === nodeData.parentId) {
                                    e.spread = true;
                                }
                                if (e.children.length > 0) {
                                    each(e.children);
                                }
                            })
                        } catch (e) {
                            console.log(e);
                        }
                    }
                    each(treeData);
                    return treeData;
                };
                var dataT = [];
                getData = function() {
                        $.ajax({
                            url: '/one/layer/tree',
                            dataType: 'json',
                            type: 'get',
                            async: false,
                            success: function(result) {
                                if (result.errorCode === '401') {
                                    loginStatusIntercept(result.msg)
                                    return
                                }
                                var treeData = result.data;
                                var stringTree = JSON.stringify(treeData);
                                var dataStr = stringTree.replace(/layerName/g, "title");
                                var dataS = dataStr.replace(/status/g, "checked");
                                dataT = JSON.parse(dataS);

                                function loop(item) {
                                    item.status = item.checked;
                                    if (item.children && item.children.length > 0) {
                                        delete item.checked;
                                        for (var i = 0; i < item.children.length; i++) {
                                            loop(item.children[i])
                                        }
                                    } else if (item.children && item.children.length == 0) {
                                        delete item.checked;
                                    } else {
                                        item.checked = item.checked == "1" ? true : false;
                                    }
                                }
                                dataT.forEach(item => loop(item));
                            }
                        });
                        if(treeObj){
                            treeObj.config.data = dataT;
                            treeObj.reload('treeId');
                        }
                        return dataT;
                    }
                    // 获取dom树加点进行dom处理操作
                var treeObj = tree.render({
                    elem: '#treeLi',
                    data: getData(),
                    id: 'treeId',
                    showCheckbox: true, //是否显示复选框
                    onlyIconControl: true, //控制点击父节点的title子节点不收缩，点击图标时进行收缩
                    customOperate: true, //自定义设置树操作
                    limitNodeAddLevel: 2, //设置第X级节点不允许添加操作
                    limitNodeDelLevel: 1, //设置第X级节点不允许删除操作
                    // ,skin: 'shihuang'
                    showLine: true, //是否开启连接线。默认 true，若设为 false，则节点左侧出现三角图标。
                    edit: ['add', 'update', 'del', 'moveup', 'movedown', 'shuxing'], //操作节点的图标
                    isJump: true, //是否允许点击节点时弹出新窗口跳转
                    click: function(obj) {
                        childWindow.viewer.mars.popup.close();
                        var id = obj.data.id;
                        EntityId.push(id);
                        if (EntityId.length !== 0) {
                            for (var i = 0; i < EntityId.length; i++) {
                                childWindow.removeEntityById(EntityId[i]);
                            }
                        }
                        // var ele = iframes.document.getElementsById('cesiumContainer-mars3d-pupup-all')
                        //关闭图层属性表
                        $("#table").css('display', 'none');
                        var checkType = obj.data.checked;
                        if (obj.data.isDir === "1") {
                            //   layer.msg("图层文件夹不可预览", {icon: 5});
                        } else {
                            if (checkType === true) {
                                layerConfigObj.preview(obj);
                            } else if (checkType === false) {
                                //layer.msg("禁用状态不可预览，请先启用图层", {icon: 5});
                                layerConfigObj.preview(obj);
                            }
                        }
                    },
                    oncheck: function(obj) {
                        checkedType = obj.checked;
                        var data = obj.data;
                        // var node = $(obj.elem);
                        // var serviceType = data.serviceType;
                        // var input = node.find("i.iconpie-chart-4beifen");
                        // if (serviceType == 2) {
                        //     node.find('div.layui-tree-btnGroup').append("<i class='iconfont iconpie-chart-4beifen' style='font-size:15px' onclick='viewtable(" + data.elementId +","+ type + ")'></i>")
                        // }
                        if (checkedType === false) { //关闭节点
                            // layerConfigObj.preview(obj);
                            layerConfigObj.start(data, checkedType);
                            // layerConfigObj.preview(obj);
                            // childWindow.removeEntityById(data.id);
                            layerConfigObj.close(data, checkedType);
                        } else if (checkedType === true) { //启用节点
                            layerConfigObj.start(data, checkedType);
                            // layerConfigObj.preview(obj);
                            if (data.isDir !== "1") {
                                var themeType = data.themeType;
                                var type = JSON.parse(themeType);
                                var node = $(obj.elem);
                                var input = node.find("i.layui-icon-add-1");
                                // input.remove();
                                if (input.length < 2) {
                                    // var node = $(obj.elem);
                                    // var input = node.find("i.iconpie-chart-4beifen");
                                    //     if (serviceType == 2) {
                                    //         node.find('div.layui-tree-btnGroup').append("<i class='iconfont iconpie-chart-4beifen' style='font-size:15px' onclick='viewtable(" + data.elementId +","+ type + ")'></i>")
                                    //     }
                                    // input.remove();
                                }

                            }
                        }
                    },
                    operate: function(obj, oldvalue) {
                        var node = $(obj.elem);
                        var type = obj.type; //得到操作类型：add、edit、del、moveup、movedown
                        var data = obj.data; //得到当前节点的数据
                        // var elem = obj.elem;//得到当前节点元素
                        var deptId = data.id; //得到节点索引
                        if (type === 'add') { //增加节点
                            layerConfigObj.add(data);
                        } else if (type === 'update') { //修改节点
                            if (obj.data.title == "未命名") {
                                layer.msg("未输入", {
                                    icon: 5
                                });
                                var txt = obj.elem.find(".layui-tree-txt");
                                txt.html(oldvalue)
                            } else {
                                layerConfigObj.update(data, obj, oldvalue);
                            }
                        } else if (type === 'del') { //删除节点
                            // console.log("del data=",data);
                            var nodelV = noDel(data.id);
                            // console.log("nodel=",nodel);
                            if(nodelV){
                                layer.msg("不能删除该图层", {
                                    icon: 5
                                });
                            }else{
                                layer.confirm('<span style="color:#000000;">确认删除?</span>', {icon: 3, title:'提示'}, function(index){
                                    layer.close(index);
                                    childWindow.removeEntityById(data.id);
                                    layerConfigObj.del(data);
                                });
                            }
                           
                        } else if (type === 'moveup') { //上移节点
                            layerConfigObj.moveup(data);
                        } else if (type === 'movedown') { //下移节点
                            layerConfigObj.movedown(data);
                        }
                    }
                });




                //执行节点勾选
                // tree.setChecked('treeId', 1); //单个勾选 id 为 1 的节点
                // tree.setChecked('treeId', [9,26]); //批量勾选 id 为 2、3 的节点
                //获得选中的节点
                // var checkData = tree.getChecked('treeId');
                // console.log(100000,checkData);
                let cols = [
                    [{
                        type: 'radio',
                        align: 'center'
                    }, {
                        title: '要素名称',
                        field: 'elementName',
                        align: 'center',
                        width: 300
                    }, {
                        title: '要素类别',
                        field: 'type',
                        align: 'center',
                        templet: '#data-type',
                        width: 300
                    }]
                ];


                table.render({
                    elem: '#user-table',
                    url: '/one/element/list',
                    method: 'post',
                    contentType: 'application/json',
                    where: {
                        status: "1",
                        requestSet: "1"
                    },
                    request: {
                        pageName: 'pageNo' //页码的参数名称，默认：page
                            ,
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    parseData: function(res) { //res 即为原始返回的数据
                        return {
                            "createTime": null,
                            "createBy": null,
                            "updateTime": null,
                            "updateBy": null,
                            "remark": null,
                            "code": 200,
                            "msg": "...",
                            "count": res.data.total,
                            "data": res.data.list
                        }
                    },
                    id: 'user-table',
                    page: true,
                    cols: cols,
                    skin: 'line',
                    even: true, //开启隔行背景
                    response: {
                        statusCode: 200 //成功的状态码，默认：0
                    },
                });
                //图层添加时复选框状态判断
                table.on('radio(user-table)', function(obj) {
                    featureId = obj.data.id;
                    // console.log(obj.data); //选中行的相关数据
                    // console.log(obj.type); //如果触发的是全选，则为：all，如果触发的是单选，则为：one
                    // console.log(table.checkStatus('user-table').data); // 获取表格中选中行的数据
                });
                /*       //按钮事件
                       util.event('user-table', {
                           getChecked: function(othis){
                               var checkedData = tree.getChecked('treeId'); //获取选中节点的数据
                               layer.alert(JSON.stringify(checkedData), {shade:0});
                               console.log(checkedData);
                           }
                       });*/

                //上移图层
                layerConfigObj.moveup = function(data) {
                    var upId = data.id;
                    var forTree = function(arr, id) {
                        for (var i = 0; i < arr.length; i++) {
                            var item = arr[i];
                            var itemUp = arr[i - 1];
                            if ((item.id === id) && (i !== 0)) {
                                item.sort = item.sort - 1;
                                itemUp.sort = itemUp.sort + 1;
                                $.ajax({
                                    url: "/one/layer",
                                    type: "PUT",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: item.elementId,
                                        id: item.id,
                                        isDir: item.isDir,
                                        parentId: item.parentId,
                                        layerName: item.title,
                                        remark: item.remark,
                                        sort: item.sort,
                                        status: item.checked ? 1 : 0
                                    }),
                                });
                                $.ajax({
                                    url: "/one/layer",
                                    type: "PUT",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: itemUp.elementId,
                                        id: itemUp.id,
                                        isDir: itemUp.isDir,
                                        parentId: itemUp.parentId,
                                        layerName: itemUp.title,
                                        remark: itemUp.remark,
                                        sort: itemUp.sort,
                                        status: itemUp.checked ? 1 : 0
                                    }),
                                    success: function(result) {
                                        if (result.errorCode === '401') {
                                            loginStatusIntercept(result.msg)
                                            return
                                        }
                                        // console.log(result);
                                        if (result.errorCode == 0) {
                                            layer.msg("上移图层成功", {
                                                icon: 6
                                            });
                                            var treeData = openTree(getData(), data.id); //解决节点操作后重新绘制树只显示根节点的问题——其实就是对后台返回数据做了处理
                                            tree.reload('treeId', {
                                                data: treeData
                                            });
                                        } else {
                                            layer.msg("上移图层失败", {
                                                icon: 5
                                            });
                                        }
                                    }
                                });
                                break;
                            } else if ((item.id === id) && (i === 0)) {
                                break;
                            } else if (item.children) {
                                forTree(item.children, id);
                            }
                        }
                        return arr;
                    };
                    forTree(dataT, upId);
                };
                // ..树展开，父节点spread字段赋值true
                openTree = function(treeData, objId, objStatus) {
                    var nodeId = familyTree(treeData, objId, objStatus);

                    function each(data) {
                        try {
                            data.forEach(e => {
                                if (nodeId.indexOf(e.id) != -1) {
                                    e.spread = true;
                                }
                                if (e.children.length > 0) {
                                    each(e.children);
                                }
                            })
                        } catch (e) {
                            console.log(e);
                        }
                    }
                    each(treeData);
                    return treeData;
                };
                // 查找一个节点的所有父节点
                var familyTree = function(arr1, id) {
                    var temp = [];
                    var forFn = function(arr, id) {
                        for (var i = 0; i < arr.length; i++) {
                            var item = arr[i];
                            if (item.id === id) {
                                temp.push(item.id);
                                forFn(arr1, item.parentId);
                                break;
                            } else {
                                if (item.children) {
                                    forFn(item.children, id);
                                }
                            }
                        }
                    };
                    forFn(arr1, id);
                    return temp;
                };
                //下移图层
                layerConfigObj.movedown = function(data) {
                    var downId = data.id;
                    var forTree = function(arr, id) {
                        for (var i = 0; i < arr.length; i++) {
                            var item = arr[i];
                            var itemDown = arr[i + 1];
                            if ((item.id === id) && (i !== arr.length - 1)) {
                                item.sort = item.sort + 1;
                                itemDown.sort = itemDown.sort - 1;
                                $.ajax({
                                    url: "/one/layer",
                                    type: "PUT",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: item.elementId,
                                        id: item.id,
                                        isDir: item.isDir,
                                        parentId: item.parentId,
                                        layerName: item.title,
                                        remark: item.remark,
                                        sort: item.sort,
                                        status: item.checked ? 1 : 0
                                    }),
                                });
                                $.ajax({
                                    url: "/one/layer",
                                    type: "PUT",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: itemDown.elementId,
                                        id: itemDown.id,
                                        isDir: itemDown.isDir,
                                        parentId: itemDown.parentId,
                                        layerName: itemDown.title,
                                        remark: itemDown.remark,
                                        sort: itemDown.sort,
                                        status: itemDown.checked ? 1 : 0
                                    }),
                                    success: function(result) {
                                        if (result.errorCode === '401') {
                                            loginStatusIntercept(result.msg)
                                            return
                                        }
                                        if (result.errorCode == 0) {
                                            layer.msg("下移图层成功", {
                                                icon: 6
                                            });
                                            var treeData = openTree(getData(), data.id); //解决节点操作后重新绘制树只显示根节点的问题——其实就是对后台返回数据做了处理
                                            tree.reload('treeId', {
                                                data: treeData
                                            });
                                        } else {
                                            layer.msg("下移图层失败", {
                                                icon: 5
                                            });
                                        }
                                    }
                                });
                                break;
                            } else if (item.children) {
                                forTree(item.children, id);
                            } else {
                                if (i === arr.length - 1) {
                                    break;
                                }
                            }
                        }
                        return arr;
                    };
                    forTree(dataT, downId);
                };

                //添加图层
                layerConfigObj.add = function(data) {
                    table.reload('user-table');
                    $('#folder').hide();
                    if (data.children.length > 0) {
                        var arr = dataT;
                        var sortMax;
                        for (var i = 0; i < arr.length; i++) {
                            var item = arr[i];
                            if (item.id === data.id) {
                                var itemChild = item.children[item.children.length - 1];
                                sortMax = itemChild.sort + 1;
                                break
                            } else {}
                        }
                        layer.open({
                            type: 1,
                            title: '添加图层',
                            shade: 0.1,
                            area: ['50%', '90%'],
                            content: $('#service-window'),
                            resize: true,
                            btn: ['确定', '取消'],
                            success: function(layero, index) {
                                $('#folder').hide();
                                $('#feature-name').show();
                                $('#feature-name').val("");
                                $('#research').val("");
                                $('#feature-detail').hide();
                                $('#featureContent').hide();
                                $('#user').show();
                                $('#research').show();
                                $('#layer-name').show();
                            },
                            yes: function(index, layero) {
                                if (!featureId || !$('#feature-name').val()) {
                                    layer.msg("请选择要素或输入图层名称", {
                                        icon: 5
                                    });
                                    return;
                                }
                                let loading = layer.load();
                                $.ajax({
                                    url: "/one/layer",
                                    type: "POST",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: featureId,
                                        isDir: '0',
                                        parentId: data.id,
                                        layerName: $('#feature-name').val(),
                                        remark: $('#feature-detail').val(),
                                        sort: sortMax,
                                        status: 1,
                                        requestSet: 1
                                    }),
                                    success: function(result) {
                                        if (result.errorCode === '401') {
                                            loginStatusIntercept(result.msg)
                                            return
                                        }
                                        if (result.success) {
                                            layer.msg("增加成功", {
                                                icon: 6
                                            }, function(i) {
                                                layer.close(i);
                                                layer.close(index); //关闭弹出层
                                            });
                                            var treeData = openTree(getData(), data.id);
                                            tree.reload('treeId', {
                                                data: treeData
                                            });
                                        } else {
                                            layer.msg("添加失败,失败原因：" + result.msg, {
                                                icon: 5
                                            });
                                        }
                                        layer.close(loading);
                                    },
                                    error: function(err) {

                                        layer.msg("后台请求出错:" + err.responseText, {
                                            icon: 2,
                                            time: 1000
                                        });
                                        layer.close(loading);
                                    }
                                });
                            }
                        });
                    } else if (data.children.length === 0) {
                        layer.open({
                            type: 1,
                            title: '添加图层',
                            shade: 0.1,
                            area: ['50%', '90%'],
                            content: $('#service-window'),
                            resize: true,
                            btn: ['确定', '取消'],
                            success: function(layero, index) {
                                $('#feature-name').show();
                                $('#feature-detail').show();
                                $('#user').show();
                                $('#research').show();
                            },
                            yes: function(index, layero) {
                                if (!featureId || !$('#feature-name').val()) {
                                    layer.msg("请选择要素或输入图层名称", {
                                        icon: 5
                                    });
                                    return;
                                }
                                $.ajax({
                                    url: "/one/layer",
                                    type: "POST",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: featureId,
                                        isDir: '0',
                                        parentId: data.id,
                                        layerName: $('#feature-name').val(),
                                        remark: $('#feature-detail').val(),
                                        sort: 0,
                                        status: 1,
                                        requestSet: 1
                                    }),
                                    success: function(result) {
                                        if (result.errorCode === '401') {
                                            loginStatusIntercept(result.msg)
                                            return
                                        }
                                        if (result.errorCode == 0) {
                                            layer.msg("增加成功", {
                                                icon: 6
                                            }, function(i) {
                                                layer.close(i);
                                                layer.close(index); //关闭弹出层
                                            });
                                            var treeData = openTree(getData(), data.id, status);
                                            tree.reload('treeId', {
                                                data: treeData
                                            });
                                        } else {
                                            layer.msg("添加失败，失败原因：" + result.msg, {
                                                icon: 5
                                            });
                                        }
                                    }
                                });
                            }
                        });
                    }
                };
                //添加图层查询要素
                form.on('select(selectFeature)', function(data) {
                    //执行重载
                    var selectValue = data.value; //得到被选中的值

                    if (selectValue === "") {
                        var demoReload = $('#demoReload');
                        //执行重载
                        table.reload('user-table', {
                            page: {
                                curr: 1 //重新从第 1 页开始
                            },
                            where: {
                                status: "1",
                                requestSet: "1",

                                elementName: demoReload.val()
                            }
                        }, 'data');
                        return;
                    }
                    var demoReload = $('#demoReload');
                    table.reload('user-table', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        },
                        where: {
                            status: "1",
                            requestSet: "1",
                            elementName: demoReload.val(),
                            type: JSON.parse(selectValue)
                        }
                    }, 'data');

                });
                $('#featureSearch').on('click', function() {
                    var selectValue = $("#selectFeature").val(); //得到被选中的值

                    if (selectValue === "") {
                        var demoReload = $('#demoReload');
                        //执行重载
                        table.reload('user-table', {
                            page: {
                                curr: 1 //重新从第 1 页开始
                            },
                            where: {
                                status: "1",
                                requestSet: "1",

                                elementName: demoReload.val()
                            }
                        }, 'data');
                        return;
                    }
                    var demoReload = $('#demoReload');
                    //执行重载
                    table.reload('user-table', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        },
                        where: {
                            status: "1",
                            requestSet: "1",
                            type: selectValue,
                            elementName: demoReload.val()
                        }
                    }, 'data');
                });
                layerConfigObj.update = function(data, obj, oldvalue) {
                    var txt = obj.elem.find(".layui-tree-txt");

                    var name = data.title;
                    if (!name || name.length > 50) {
                        layer.msg("名称不能超过50个字", {
                            icon: 5
                        });
                        $(txt[0]).html(oldvalue)
                        return;
                    }

                    $.ajax({
                        url: "/one/layer",
                        type: "PUT",
                        dataType: "json",
                        contentType: "application/json; charset=UTF-8",
                        data: JSON.stringify({
                            elementId: data.elementId,
                            id: data.id,
                            isDir: data.isDir,
                            parentId: data.parentId,
                            layerName: data.title,
                            remark: data.remark,
                            sort: data.sort,
                            status: data.status
                        }),
                        success: function(result) {
                            if (result.errorCode === '401') {
                                loginStatusIntercept(result.msg)
                                return
                            }
                            if (result.success) {
                                layer.msg("修改成功", {
                                    icon: 6
                                });
                            } else {
                                $(txt[0]).html(oldvalue)
                                layer.msg("修改失败,失败原因：" + result.msg, {
                                    icon: 5
                                });

                            }
                        }
                    });
                };
                layerConfigObj.del = function(data) {
                    var id = data.id;
                    var arrNew = new Array(); //创建了一个长度为0的数组对象。
                    arrNew.push(id);
                    $.ajax({
                        url: "/one/layer?" + "ids=" + arrNew.join("&ids="),
                        type: "DELETE",
                        dataType: "json",
                        contentType: "application/json; charset=UTF-8",
                        success: function(result) {
                            if (result.errorCode === '401') {
                                loginStatusIntercept(result.msg)
                                return
                            }
                            if (result.errorCode == 0) {
                                layer.msg("删除成功", {
                                    icon: 6
                                });
                                getData();
                            } else {
                                layer.msg("删除失败", {
                                    icon: 5
                                });
                            }
                        }
                    });
                    var arr = dataT;
                    if (data.parentId !== 0) {
                        for (var i = 0; i < arr.length; i++) {
                            if ((arr[i].children[0]) && (data.parentId === arr[i].children[0].parentId)) {
                                for (var j = 0; j < arr[i].children.length; j++) {
                                    var arrChild = arr[i].children[j];
                                    if (arrChild.sort > data.sort) {
                                        arrChild.sort = arrChild.sort - 1;
                                        $.ajax({
                                            url: "/one/layer",
                                            type: "PUT",
                                            dataType: "json",
                                            contentType: "application/json; charset=UTF-8",
                                            data: JSON.stringify({
                                                elementId: arrChild.elementId,
                                                id: arrChild.id,
                                                isDir: arrChild.isDir,
                                                parentId: arrChild.parentId,
                                                layerName: arrChild.title,
                                                remark: arrChild.remark,
                                                sort: arrChild.sort,
                                                status: arrChild.checked ? 1 : 0
                                            }),
                                            success: function(result) {
                                                /*      if(result.errorCode==0){
                                                          layer.msg("删除成功", {icon: 6});
                                                         /!* var treeData = openTree(getData(),data.id);//解决节点操作后重新绘制树只显示根节点的问题——其实就是对后台返回数据做了处理
                                                          tree.reload('treeId', {data: treeData});*!/
                                                      }else{
                                                          layer.msg("删除失败", {icon: 5});
                                                      }*/
                                            }
                                        });
                                    } else {}
                                }
                            } else {}
                        }
                    } else {
                        for (var i = 0; i < arr.length; i++) {
                            var item = arr[i];
                            if (item.sort > data.sort) {
                                item.sort = item.sort - 1;
                                $.ajax({
                                    url: "/one/layer",
                                    type: "PUT",
                                    dataType: "json",
                                    contentType: "application/json; charset=UTF-8",
                                    data: JSON.stringify({
                                        elementId: item.elementId,
                                        id: item.id,
                                        isDir: item.isDir,
                                        parentId: item.parentId,
                                        layerName: item.title,
                                        remark: item.remark,
                                        sort: item.sort,
                                        status: item.checked ? 1 : 0
                                    }),
                                    success: function(result) {
                                        /*      if(result.errorCode==0){
                                                  layer.msg("删除成功", {icon: 6});
                                                /!*  var treeData = openTree(getData(),data.id);//解决节点操作后重新绘制树只显示根节点的问题——其实就是对后台返回数据做了处理
                                                  tree.reload('treeId', {data: treeData});*!/
                                              }else{
                                                  layer.msg("删除失败", {icon: 5});
                                              }*/
                                    }
                                });
                            } else {}
                        }
                    }
                };

                //添加图层文件夹
                $('#layer_add').on('click', function() {
                    if (dataT.length === 0) {
                        var sortMax = 0
                    } else {
                        var item = dataT[dataT.length - 1];
                        sortMax = item.sort + 1;
                    }
                    let flag = true;
                    layer.open({
                        type: 1,
                        title: '添加图层文件夹',
                        shade: 0.1,
                        area: ['50%', '30%'],
                        content: $('#service-window'),
                        resize: true,
                        btn: ['确定', '取消'],
                        success: function(layero, index) {
                            $('#folder').show();
                            $('#feature').val("");
                            $('#feature-detail').hide();
                            $('#featureDetail').hide();
                            $('#user').hide();
                            $('#research').hide();
                            $('#layer-name').hide();
                        },
                        yes: function(index, layero) {
                            if (!flag) return;
                            flag = false;
                            let loading = layer.load();
                            $.ajax({
                                url: "/one/layer",
                                type: "POST",
                                data: JSON.stringify({
                                    layerName: $('#feature').val(),
                                    parentId: 0,
                                    isDir: 1,
                                    sort: sortMax,
                                    remark: $('#feature-detail').val(),
                                    status: 1
                                }),
                                dataType: "json",
                                contentType: "application/json; charset=UTF-8",
                                success: function(result) {
                                    if (result.errorCode === '401') {
                                        loginStatusIntercept(result.msg)
                                        return
                                    }
                                    setTimeout(() => {
                                            flag = true
                                        }, 4000)
                                        //    console.log(result);
                                    if (result.success) {
                                        layer.msg("增加成功", {
                                            icon: 6
                                        }, function(i) {
                                            layer.close(i);
                                            layer.close(index); //关闭弹出层
                                            //放开隐藏的图层名称输入框
                                            $('#layer-name').show();
                                        });
                                        tree.reload('treeId', {
                                            data: getData()
                                        });
                                    } else {
                                        layer.msg("添加失败,失败原因：" + result.msg, {
                                            icon: 5
                                        });
                                    }
                                    layer.close(loading);
                                },
                                error: function(err) {

                                    layer.msg("后台请求出错:" + err.responseText, {
                                        icon: 2,
                                        time: 1000
                                    });
                                    layer.close(loading);
                                }
                            });
                        }
                    });
                });
            });

            function noDel(id){
                switch(id){
                    //物业规划
                    case 299: 
                        return true;
                    case 319: 
                        return true;
                    case 359: 
                        return true;
                    case 318: 
                        return true;
                    //资产财务
                    case 333: 
                        return true;
                    case 334: 
                        return true;
                    case 336: 
                        return true;
                    case 335: 
                        return true;
                    case 341: 
                        return true;
                    case 340: 
                        return true;
                    case 343: 
                        return true;
                    case 342: 
                        return true;
                    // 物业产权   
                    case 320: 
                        return true;
                    case 325: 
                        return true;
                    case 323: 
                        return true;
                    case 326: 
                        return true;
                    case 328: 
                        return true;
                    case 329: 
                        return true;
                    case 331: 
                        return true;
                    // 物业经营    
                    case 344: 
                        return true;
                    case 347: 
                        return true;
                    case 345: 
                        return true;
                    case 348: 
                        return true;
                    case 346: 
                        return true;
                    case 349: 
                        return true;
                    // 物业日常
                    case 350: 
                        return true;
                    case 353: 
                        return true;
                    case 376: 
                        return true;
                    case 377: 
                        return true;
                    case 378: 
                        return true;
                    case 379: 
                        return true;
                }
                return false;
            }

            $('#tableclose').on('click', function() {
                // childWindow = $("#layer_iframe")[0].contentWindow;
                //
                // childWindow.clearEntity();
                // $("#tablecontent").bootstrapTable('destroy');
                $("#table").hide();
            })
        };

        //layui Table图层属性表后端分页
        function viewtable(id, type) {
            var cols;

            switch (type) {
                case 1:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 2:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 3:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 4:
                    cols = [
                        [{
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'peopleNum',
                            title: '人口数（人）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'needNum',
                            title: '需求数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'planNum',
                            title: '规划数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingNum',
                            title: '在建数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'existNum',
                            title: '现状数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'lackNum',
                            title: '缺口（套）',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 5:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'phase',
                            title: '阶段',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 6:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'phase',
                            title: '阶段',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 7:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 8:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 9:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 10:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 11:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 12:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 13:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 14:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 15:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 16:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;

                case 17:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;

                case 18:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 19:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 20:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 21:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 22:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 23:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 24:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 25:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 26:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 27:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '投资金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 28:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 29:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 30:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 31:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 32:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'rentRate',
                            title: '出租率（%）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 33:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'emptyRate',
                            title: '空置率（%）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 34:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'desc',
                            title: '修缮情况',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 35:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'desc',
                            title: '装修情况',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 36:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '金额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 37:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'amount',
                            title: '投资额（元）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 38:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 39:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 40:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'num',
                            title: '数量（套）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
                    break;
                case 41:
                    cols = [
                        [{
                            field: 'address',
                            title: '地址',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'area',
                            title: '面积（m²）',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'buildingName',
                            title: '建筑名称',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'community',
                            title: '社区',
                            editable: false,
                            align: 'left'
                        }, {
                            field: 'type',
                            title: '类型',
                            editable: false,
                            align: 'left'
                        }, ]
                    ];
            }

            $("#table").show();
            layui.use(['table'], function() {
                let table = layui.table;
                table.render({
                    elem: '#table-business',
                    url: '/one/element/viewBusinessProperty',
                    method: 'POST',
                    contentType: 'application/json',
                    where: {
                        elementId: id,
                    },
                    request: {
                        pageName: 'pageNo' //页码的参数名称，默认：page
                            ,
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    parseData: function(res) { //res 即为原始返回的数据
                        return {
                            "createTime": null,
                            "createBy": null,
                            "updateTime": null,
                            "updateBy": null,
                            "remark": null,
                            "code": 200,
                            "msg": "...",
                            "count": res.data.total,
                            "data": res.data.list
                        }
                    },
                    id: 'table-business',
                    page: true,
                    cols: cols,
                    skin: 'line',
                    // toolbar: '#user-toolbar',
                    response: {
                        statusCode: 200 //成功的状态码，默认：0
                    },
                    defaultToolbar: [{
                            layEvent: 'refresh',
                            icon: 'layui-icon-refresh',
                        }, 'filter'] // , 'print', 'exports'
                });
            });

        }
        //批量删除
        // $('#batchRemove').on('click', function(){
        //      var checkData = tree.getChecked('treeId');
        //      console.log(checkData);
        //      let ids = [];
        //
        //     checkData.forEach(item=>{
        //         item.children&&item.children.forEach(item=>{
        //             if(item.checked==true){
        //                 ids.push(item.id)
        //             }
        //         })
        //     })
        //     console.log(ids,13)
        //     layer.open({
        //         title: '批量删除'
        //         ,content: '确认批量删除图层吗',
        //         yes: function(index, layero){
        //             $.ajax({
        //                 url: "/one/layer",
        //                 type: "DELETE",
        //                 data:"ids="+ids.join("&ids="),
        //                 success: function(result){
        //                     if(result.success){
        //                         layer.msg("批量删除成功", {icon: 6}, function(i){
        //                             layer.close(i);
        //                             layer.close(index);//关闭弹出层
        //                         });
        //                         var treeData = openTree(getData(),0);
        //                         tree.reload('treeId', {data: treeData});
        //                     }else{
        //                         layer.msg("添加失败,失败原因："+result.msg, {icon: 5});
        //                     }
        //                     layer.close(index); //如果设定了yes回调，需进行手工关闭
        //                 },
        //                 error:function (err) {
        //                     layer.msg("后台请求出错:"+err.responseText,{icon:2,time:1000});
        //                     layer.close(loading);
        //                 }
        //             })
        //
        //         }
        //     });
        //
        //
        //
        // });

        //bootstrapTable图层属性表前端分页
        /*function viewtable(id) {
            var cols = [
                [{
                        field: '"amount"',
                        title: '数量',
                        editable: false,
                        align: 'left'
                    }, {
                        field: 'address',
                        title: '地址',
                        editable: false,
                        align: 'left'
                    }, {
                        field: 'buildingName',
                        title: '建筑名称',
                        editable: false,
                        align: 'left'
                    }, {
                        field: 'name',
                        title: '名称',
                        editable: false,
                        align: 'left'
                    },
                    // { field: 'name', title: '名称',  editable: false, align: 'left' },
                    {
                        field: '"community"',
                        title: '社区',
                        editable: false,
                        align: 'left'
                    },
                ]
            ];

                            url: "/one/element/viewBusinessProperty?elementId="+id+'&pageNo=1&pageSize=10',
                            type: "GET",
                            dataType: "json",
                            contentType: "application/json",
                         /!*   data:JSON.stringify({
                                elementId:id,
                                pageNo: 1,
                                pageSize: 10
                            }),*!/
                            success: function(result) {
                                debugger
                                if (result.errorCode == 0) {
                                    console.log(111,result.data);
                                    var elementContent = result.data.list;
                                    var count = result.data.total;
                                    console.log(333,count);
                                    var cols = [];
                                    // cols.push({
                                    //     checkbox: 'true'
                                    // });
                                    for (var i = 0; i < elementContent.length; i++) {
                                        if (i === 0) {
                                            for (var key in elementContent[i]) {
                                                cols.push({
                                                    title: key,
                                                    field: key
                                                })
                                            }
                                        }
                                    }
                                    console.log(222,cols);
                                    $("#table").show();
                                    $('#tablecontent').bootstrapTable({
                                        url: "/one/element/viewBusinessProperty",
                                        method: "GET",
                                        striped: true, //是否显示行间隔色
                                        singleSelect: true, // 单选checkbox
                                        dataType: "json",
                                        pagination: true, //分页
                                        pageSize: 10,
                                        pageNumber: 1,
                                        // pageList : [ 5, 10, 20, 30 ],//可选择单页记录数
                                        search: false, //显示搜索框
                                        contentType: "application/json",
                                        showExport: true,                     //是否显示导出
                                        exportDataType: "basic",              //basic', 'all', 'selected'.导出的模式是当前页、所有数据还是选中数据
                                        queryParamsType: 'limit',
                                        sidePagination: "server",//分页方式：client客户端分页，server服务端分页（*）
                                        queryParams: function(params) {
                                            return {
                                                // startindex: params.offset,
                                                // count: params.limit,
                                                // rows: count,                         //页面大小
                                                // page: (params.offset / params.limit) + 1,   //页码
                                               /!* offset: params.offset,  //页码
                                                pageSize:this.pageSize,
                                                pageNumber:this.pageNumber,*!/
                                                elementId:id,
                                                pageNo: 1,
                                                pageSize: 10
                                            };
                                        },
                                        //把数据转换为bootstrap-table能接受的数据格式。
                                        responseHandler: function(data) {
                                            console.log(3331,data.data);
                                            var elementContent = data.data.list;
                                            var result = {};
                                            result.total = count;
                                            var data = [];
                                            for (var i = 0; i < elementContent.length; i++) {
                                                data.push(elementContent[i])
                                            }
                                            result.rows = data;
                                            return result;
                                        },
                                        columns: cols
                                    });

                                }
                            }
                        });*!/


        }*/
        //bootstrapTable图层属性表前端分页
        /*        function viewtable(id) {
                    $.ajax({
                        url: "/one/layer/elementInfo",
                        type: "GET",
                        dataType: "json",
                        data: {
                            id: id
                        },
                        contentType: "application/json",
                        success: function(result) {
                            if (result.errorCode == 0) {
                                var elementContent = result.data.elementContent;
                                var countFea=JSON.parse(elementContent);
                                var features = countFea.features;
                                var count = features.length;
                                var cols = [];
                                // cols.push({
                                //     checkbox: 'true'
                                // });
                                for (var i = 0; i < features.length; i++) {
                                    if (i === 0) {
                                        for (var key in features[i].properties.attr) {
                                            cols.push({
                                                title: key,
                                                field: key
                                            })
                                        }
                                    }
                                }
                                $("#table").show();
                                $('#tablecontent').bootstrapTable({
                                    url: "/one/layer/elementInfo?id="+id,
                                    method: "GET",
                                    striped: true, //是否显示行间隔色
                                    singleSelect: true, // 单选checkbox
                                    dataType: "json",
                                    pagination: true, //分页
                                    pageSize: 10,
                                    pageNumber: 1,
                                    // pageList : [ 5, 10, 20, 30 ],//可选择单页记录数
                                    search: false, //显示搜索框
                                    contentType: "text/html;charset=UTF-8",
                                    queryParamsType: 'limit',
                                    sidePagination: "server",//分页方式：client客户端分页，server服务端分页（*）
                                    queryParams: function(params) {
                                        var childWindow = $("#layer_iframe")[0].contentWindow;
                                        childWindow.clearEntity();
                                        return {
                                            // startindex: params.offset,
                                            // count: params.limit
                                            rows: params.limit,                         //页面大小
                                            page: (params.offset / params.limit) + 1,   //页码
                                        };
                                    },
                                    responseHandler: function(data) {
                                        var elementContent = data.data.elementContent;
                                        var countFea=JSON.parse(elementContent);
                                        var result = {};
                                        result.total = count;
                                        var features = countFea.features;
                                        var data = [];
                                        for (var i = 0; i < features.length; i++) {
                                            features[i].properties.geom = features[i].geometry
                                            data.push(features[i].properties.attr)
                                        }
                                        result.rows = data;
                                        return result;
                                    },
                                    /!*     onClickRow: function(row, $element, field) {
                                             console.log(999,row);
                                             var childWindow = $("#layer_iframe")[0].contentWindow;
                                             childWindow.addEntity(row);
                                         },*!/
                                    columns: cols
                                });
                            }
                        }
                    });
                }*/

        // function loadGeoJson(url) {
        //     url = url.replace('&version=1.0.0', '&version=2.0.0')
        //     $("#table").show();
        //     $.ajax({
        //         url: url + "&startindex=0&count=10",
        //         type: "GET",
        //         dataType: "json",
        //         contentType: "application/json; charset=UTF-8",
        //         success: function(result) {
        //             var count = result.totalFeatures;
        //             var features = result.features;
        //             var cols = [];
        //             cols.push({
        //                 type: 'radio'
        //             })
        //             for (var i = 0; i < features.length; i++) {

        //                 if (i === 0) {
        //                     for (var key in features[i].properties) {
        //                         cols.push({
        //                             title: key,
        //                             field: key
        //                         })
        //                     }
        //                 }
        //             }
        //             $('#tablecontent').bootstrapTable({
        //                 url: url + "&sortBy=" + cols[1].title,
        //                 method: "get",
        //                 striped: true,
        //                 singleSelect: false,
        //                 dataType: "json",
        //                 pagination: true, //分页
        //                 pageSize: 10,
        //                 pageNumber: 1,
        //                 search: false, //显示搜索框
        //                 contentType: "text/html;charset=UTF-8",
        //                 queryParamsType: 'limit',
        //                 sidePagination: "server",
        //                 queryParams: function(params) {
        //                     childWindow = $("#layer_iframe")[0].contentWindow;
        //                     childWindow.clearEntity();
        //                     return {
        //                         startindex: params.offset,
        //                         count: params.limit
        //                     };
        //                 },
        //                 responseHandler: function(data) {
        //                     var result = {};
        //                     result.total = count;
        //                     var features = data.features;
        //                     var data = [];

        //                     for (var i = 0; i < features.length; i++) {
        //                         features[i].properties.geom = features[i].geometry
        //                         data.push(features[i].properties)
        //                     }
        //                     result.rows = data;
        //                     return result;
        //                 },
        //                 onClickRow: function(row, $element, field) {
        //                     childWindow = $("#layer_iframe")[0].contentWindow;

        //                     childWindow.addEntity(row);
        //                 },
        //                 columns: cols
        //             });
        //  $('#table').bootstrapTable("refresh");
        // layui.use([ 'table' ], function() {
        //     let table = layui.table;
        //
        //     table.render({
        //         elem: '#tablecontent',
        //
        //         data:data,
        //         id: 'data-table',
        //         page: true,
        //         cols: [cols],
        //         totalRow:parseInt(count),
        //         limit:10,
        //         skin: 'line',
        //         even: true,//开启隔行背景
        //
        //     });
        //     //图层添加时复选框状态判断
        //     // table.on('radio(user-table)', function(obj){
        //     //     featureId=obj.data.id;
        //     //     // console.log(obj.checked); //当前是否选中状态
        //     //     // console.log(obj.data); //选中行的相关数据
        //     //     // console.log(obj.type); //如果触发的是全选，则为：all，如果触发的是单选，则为：one
        //     //     // console.log(table.checkStatus('user-table').data); // 获取表格中选中行的数据
        //     // });
        //
        //
        // });



        // let cols = [
        //     [
        //         {type:'radio',align:'center'},
        //         {title: '要素名称', field: 'elementName', align:'center', width:300},
        //         {title: '要素类别', field: 'type', align:'center', templet:'#data-type', width:300}
        //     ]
        // ];
        // layui.use(['tree', 'util','table','form'], function() {
        //     let table = layui.table;
        //
        //     table.render({
        //         elem: '#tablecontent',
        //         url: url,
        //         method: 'post',
        //         contentType: 'application/json',
        //         where: {status: "1", requestSet: "1"},
        //         request: {
        //             pageName: 'startindex' //页码的参数名称，默认：page
        //             , limitName: 'count' //每页数据量的参数名，默认：limit
        //         },
        //         parseData: function (res) { //res 即为原始返回的数据
        //             return {
        //                 "createTime": null,
        //                 "createBy": null,
        //                 "updateTime": null,
        //                 "updateBy": null,
        //                 "remark": null,
        //                 "code": 200,
        //                 "msg": "...",
        //                 "count": res.data.total,
        //                 "data": res.data.list
        //             }
        //         },
        //         id: 'data-table',
        //         page: true,
        //         cols: cols,
        //         skin: 'line',
        //         even: true,//开启隔行背景
        //         response: {
        //             statusCode: 200 //成功的状态码，默认：0
        //         },
        //     });
        //图层添加时复选框状态判断
        // table.on('radio(user-table)', function(obj){
        //     featureId=obj.data.id;
        //     // console.log(obj.checked); //当前是否选中状态
        //     // console.log(obj.data); //选中行的相关数据
        //     // console.log(obj.type); //如果触发的是全选，则为：all，如果触发的是单选，则为：one
        //     // console.log(table.checkStatus('user-table').data); // 获取表格中选中行的数据
        // });

        // $.ajax({
        //     url: url+"&startindex=0&count=10",
        //     type: "GET",
        //     dataType: "json",
        //     contentType: "application/json; charset=UTF-8",
        //
        //     success: function(result){
        //        var count= result.totalFeatures;
        //        var features=result.features;
        //
        //     }
        // });
        //  });
        //  loadGeoJson("http://localhost:8080/geoserver/guitu/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=guitu:jiedao4547&maxFeatures=50&outputFormat=application%2Fjson")
    </script>
</body>

</html>